set(zlib_directory zlib-1.2.3)

if(CMAKEPORTS_ASSEMBLE)
    # This section is used only in CMakePorts SVN
    set(zlib_directory ${zlib_directory} PARENT_SCOPE)
    set(zlib_url http://www.zlib.net/zlib-1.2.3.tar.gz PARENT_SCOPE)
    set(zlib_tarball zlib-1.2.3.tar.gz   PARENT_SCOPE)
    set(zlib_patches zlib-1.2.3_cmp.diff PARENT_SCOPE)
endif()

if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${zlib_directory}")
    add_subdirectory(${zlib_directory})
endif()

# Compatibility settings for interoperability with FindZLIB.cmake
set(ZLIB_FOUND 1 CACHE INTERNAL "found zlib")
set(ZLIB_LIBRARY zlib CACHE INTERNAL "zlib library")
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${zlib_directory} CACHE INTERNAL "zlib include directory")
#set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR} CACHE INTERNAL "zlib include directories")
#set(ZLIB_LIBRARIES ${ZLIB_LIBRARY} CACHE INTERNAL "zlib libraries")
